<template>
  <van-search v-model="value" placeholder="请输入搜索关键词" show-action>
    <template #action>
      <div @click="handleSearch">搜索</div>
    </template>
  </van-search>
</template>

<script lang="ts" setup>
  import { ref, defineEmits } from 'vue';

  const emit = defineEmits(['onSearch']);

  const value = ref('');
  const handleSearch = () => {
    emit('onSearch', value.value);
  };
</script>

<style lang="less" scoped></style>
